<!DOCTYPE html>
<html>
	<head>
	<meta charset="utf-8">
	<title>业绩考核</title>
	<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">		
	<link rel="stylesheet" href="css/mui.min.css">
	<link rel="stylesheet" href="css/grandeHealth.css">
	<link rel="stylesheet" type="text/css" href="css/myList.css"/>
	</head>
	<body>
		<!--<header>class="mui-bar mui-bar-nav" style="display: block;height: 64px;padding-top:20px">-->
	      <!--<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>-->
	    <!--</header>-->
		<!--下拉刷新容器-->
	    <div class="mui-scroll-wrapper" id="pullrefresh">
	      <div class="mui-scroll">
	        <!-- 数据列表 -->
	        <ul class="mui-table-view">
				<!--<li class="mui-table-view-cell">
					<img class="mui-pull-left" src="images/banner_1@2x.png"> 
					<div class="mui-media-body"> 
						<span class="kaoheDate">2017-07-31</span> 
						<p class="name">李医生</p> 
						<p class="stars">
							<img src="images/kaoheStar.png"/>
							<img src="images/kaoheStar.png"/>
							<img src="images/kaoheStar.png"/>
							<img src="images/kaoheStar.png"/>
							<img src="images/kaoheStar.png"/>
						</p>
						<p class="department">服务态度好，业态度好，业务水平高。高。服务态度好，业务水平高。</p>
					</div> 
				</li>-->
	       </ul>
	      </div>
	    </div>
	    <!--暂无记录-->
	    <div class="mui-content" style="display: none;">
	      <div class="nomessage">
	        <img src="images/zanwujilu.png" />
	        <p>暂无记录</p>
	      </div>
	    </div>    
		<script src="js/jquery-1.7.2.min.js"></script>
		<script src="js/mui.min.js"></script>
		<script src="js/grandeHealth.js"></script>
		<script src="js/medicalRecord.js"></script>
		<script>		
			mui.init({
		        pullRefresh: {
		          container: '#pullrefresh',
		          down: {
		            callback: pulldownRefresh
		          },
		          up: {
		            contentrefresh: '正在加载...',
		            callback: pullupRefresh
		          }
		        }
	      });

//			var XHDOC_APP_USRGUID = '59206BEE10ABE361E050007F0100077D';
			var arry = {};
			var count = 1;
			var totalNumber;//总条数
			var webUrl = XHDOC_WEBBASE + "Docpl/Select?&pageSize=10&crtusr="+XHDOC_APP_USRGUID;
			var imgurl = 'http://106.14.139.5:7014/GZ/images/getimages?guid=';
			var totalNumber;//总条数
			var stars = '';
			function jiaohu() {
				try {
					  $.ajax({
					    url: webUrl,
					    type: "GET",
						async: false,
						dataType: "json",
						data: {
						  pageNo: count
						},
						success: function(data) {
					  		try {
					  			
							  	totalNumber = Math.ceil(data.data.totalRecord/10);//总条数
							    if(data.code == 000){
							    	arry = data.data;
							    	
							    }else if(data.code == 001){
							    	mui.toast('请求出错'); 
							    }
					  		} catch(e) {
						    
						    	mui.toast('获取数据失败');
					  		}
						},
						error: function(xhr, textStatus, error) {						
							if(textStatus == "error")
							mui.toast('请检查网络连接');
						}
						
					  });
					
					} catch(e) {
					
					  mui.toast("请检查网络连接");
					
				    }
				
				};
	
	      /**
	       * 下拉刷新具体业务实现
	//     */
	      function pulldownRefresh() {
	        jiaohu();
	        setTimeout(function() {
	          
	          var table = document.body.querySelector('.mui-table-view');
	          var cells = document.body.querySelectorAll('.mui-table-view-cell');
	          for(var i = 0; i < arry.length; i++) {
	            var li = document.createElement('li');
	            li.className = 'mui-table-view-cell mui-media';				
				stars = arry.parameterType[i].star/20;
				var starli = '<img src="images/kaoheStar.png"/>';
				if(stars == 5){
					starli = starli+starli+starli+starli+starli;
				}else if(stars == 4){
					starli = starli+starli+starli+starli;
				}else if(stars == 3){
					starli = starli+starli+starli;
				}else if(stars == 2){
					starli = starli+starli;
				}else{
					starli = starli;
				}
				
				li.innerHTML = 
							'<img class="mui-pull-left" src="'+imgurl+arry.parameterType[i].guid+'">'+
							'<div class="mui-media-body">'+
								'<span class="kaoheDate">'+arry.parameterType[i].dat+'</span>'+
								'<p class="name">'+arry.parameterType[i].name+'</p>'+
								'<p class="stars">'+starli+'</p>'+
								'<p class="department">'+arry.parameterType[i].content+'</p>'+
							'</div>';
							
	          }
	          mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
	
	        }, 1500);
	        
	      }
	
	    /**
	     * 上拉加载具体业务实现
	     */
	      function pullupRefresh() {
	
	        jiaohu();
	        
	        setTimeout(function() {         
	          mui('#pullrefresh').pullRefresh().endPullupToRefresh((++count >= totalNumber+1)); //参数为true代表没有更多数据了。
	          var table = document.body.querySelector('.mui-table-view');
	          var cells = document.body.querySelectorAll('.mui-table-view-cell');
	          if(arry.parameterType == ''){
		    		setTimeout("$('.mui-content').show();",1300);
		    	}
	          for(var i = 0, len = i + 10; i < len; i++) {
	            var li = document.createElement('li');
	            li.className = 'mui-table-view-cell mui-media';					
				stars = arry.parameterType[i].star/20;
				var starli = '<img src="images/kaoheStar.png"/>';
				if(stars == 5){
					starli = starli+starli+starli+starli+starli;
				}else if(stars == 4){
					starli = starli+starli+starli+starli;
				}else if(stars == 3){
					starli = starli+starli+starli;
				}else if(stars == 2){
					starli = starli+starli;
				}else{
					starli = starli;
				}
				li.innerHTML = 
								'<img class="mui-pull-left" src="'+imgurl+arry.parameterType[i].guid+'">'+
								'<div class="mui-media-body">'+
									'<span class="kaoheDate">'+arry.parameterType[i].dat+'</span>'+
									'<p class="name">'+arry.parameterType[i].name+'</p>'+
									'<p class="stars">'+starli+'</p>'+
									'<p class="department">'+arry.parameterType[i].content+'</p>'+
								'</div>';
	            table.appendChild(li);
	          }
	
	        }, 1500);
	      }
	
	      if(mui.os.plus) {
	        mui.plusReady(function() {
	          setTimeout(function() {
	            mui('#pullrefresh').pullRefresh().pullupLoading();
	          }, 1000);
	
	        });
	      } else {
	        mui.ready(function() {
	          mui('#pullrefresh').pullRefresh().pullupLoading();
	        });
	      }
	      
	      //线上病历详情查看跳转
			mui("body").on("tap", ".my_recode", function() {
				var thisId = $(this).attr('id');
				showpage("online_Record_details.html?guid=" + thisId);			
			})
			
			
			//返回箭头事件
//			mui.back = function() {
//				
//				console.log('进入返回事件...');
//				
//				try {
//	
//					if(XHDOC_BROWSETYPE == 'IOS') {
//						
//						//调用ios的返回事件
//						
//					} else if(XHDOC_BROWSETYPE == 'ANDROID') {
//	
//						console.log('进入安卓判断fromtips值为:'+fromtips);
//						
//						if(fromtips == "first") {
//							window.history.go(-1);
//						}else{
//							location.href = 'health-record.html?b=1';
//						}
//	
//					}
//	
//				} catch(e) {
//					console.log(e);
//				}
//	
//			}
			
	    </script>		
	</body>
</html>


